package com.itheima.网络编程.tcp编程.tcp编程.文件上传线程池;

import java.io.*;
import java.net.Socket;

public class 文件上传客户端二 {
    public static void main(String[] args) throws IOException {
        Socket sk=new Socket("127.0.0.1",10001);
        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("day16 网络编程\\subways.txt"));
        BufferedOutputStream bos=new BufferedOutputStream(sk.getOutputStream());
        byte[] bys=new byte[1024];
        int len;
        while ((len=bis.read())!=-1){
            bos.write(bys,0,len);
            bos.flush();
        }
        sk.shutdownOutput();
        System.out.println("===========================");
        BufferedReader br=new BufferedReader(new InputStreamReader(sk.getInputStream()));
        String str;
        while ((str=br.readLine())!=null){
            System.out.println(str);
        }
        sk.close();
        br.close();
        bis.close();
        bos.close();
    }
}
